package Work4.Slay_the_Maze.Events;

import java.util.ArrayList;
import java.util.Random;
import Work4.Slay_the_Maze.Monsters.*;
import Work4.Slay_the_Maze.Player.*;
import Work4.Slay_the_Maze.GameSystem.*;

public class BattleEvent extends Events {
	public BattleEvent() {
		super("战斗!","有怪物拦住了你的去路");
	}
	public void BattleBegin(Player player,boolean monstertype) {
		MonstersPool monsterspool=new MonstersPool(monstertype);
		ArrayList<Monster> monsters=new ArrayList<Monster>();
		Monster monster1=monsterspool.RandomgetMonster();
		monsters.add(monster1.clone());
		if(monstertype) {
			Random rd=new Random();
			if((rd.nextInt(100)+1)<20) {
				Monster monster2=monsterspool.RandomgetMonster();
				monsters.add(monster2.clone());
			}
		}//如果monstertype为true，弱怪有概率额外生成一只怪物
		BattleSystem battle=new BattleSystem();
		battle.Battle(player, monsters,monstertype);
		
	}
	public void doit(Player player) {
		Random rd=new Random();
		boolean monstertype;
		int temp=rd.nextInt(100)+1;
		if(temp>=1&&temp<=90) {
			monstertype=true;
		}else {
			monstertype=false;
		}
		BattleBegin(player,monstertype);
	}
}
